From 4df93140398f911ee310566928027f4865903c4e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 19 Jun 2021 06:57:38 -0700 Subject: [PATCH] wayland: Fix some dnd corner case We must call gdk_drag_drop_done() when the drag ends, successfully or not. Without this, we get an unwarranted emission of ::cancel after a successful drop. Since only the first call to gdk_drag_drop_done() is taking effect, it is safe to call as a fallback, after emitting ::dnd-finished. If the application connects to that signal and calls gdk_drag_drop_done() itself, its call will take precedence. This matches what the X11 implementation does. --- gdk/wayland/gdkdrag-wayland.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c index de80afe020..8a8c4cc058 100644 --- a/gdk/wayland/gdkdrag-wayland.c +++ b/gdk/wayland/gdkdrag-wayland.c @@ -163,6 +163,7 @@ gdk_wayland_drag_cancel (GdkDrag *drag, GdkDragCancelReason reason) { gdk_drag_set_cursor (drag, NULL); + gdk_drag_drop_done (drag, FALSE); } static void @@ -290,6 +291,7 @@ data_source_dnd_finished (void *data, GdkDrag *drag = data; g_signal_emit_by_name (drag, "dnd-finished"); + gdk_drag_drop_done (drag, TRUE); } static void -- 2.30.2